<template>
  <!-- <WorkflowLayout /> -->
  <div>
    <span style="font-size: 16px; margin-right: 30px" @click="doShowWin()">规划器</span>
    <span style="font-size: 16px" @click="doShowWin('operation')">流程操作</span>
  </div>
</template>

<script>
  import { defineComponent } from 'vue';
  import { showWorkFlowWin, showWorkFlowOperationWin } from '@/hooks/util';
  import { useMicroStore } from '@common/store/micro-store';
  export default defineComponent({
    name: 'Workflow',
    components: {},
    setup() {
      const doShowWin = (type) => {
        if (type == 'operation') {
          showWorkFlowOperationWin({
            beanId: '7af74a27f3e240c09a0a465f4973503d',
            dataInfo: {
              funcCode: 'TEST_PTLC_2',
              tableCode: 'TEST_PTLC',
              funcName: '普通流程_2',
              pd: 'test',
              pdid: 'GnZNmhnQC8aGZFyS6CW:1:b8276b53-d056-11ee-9bb7-0242f87b94e8',
              piid: '72eabdca-d058-11ee-bef9-0242f87b94e8',
              wfState: 'WAIT',
            },
          });
        } else {
          showWorkFlowWin({ workflowId: '' }, () => {});
        }
      };
      // 获取子应用store
      const microStore = useMicroStore();

      // 注册事件
      microStore.on('workflow-init', ({ workflowId, funcData }, fn) => {
        // ...业务逻辑
        showWorkFlowWin({ workflowId, funcData }, fn);
      });
      return { doShowWin };
    },
  });
</script>
